<template>
  <div class="wrapper">
    <!--左边部分-->
    <div class="col-full">
      <div class="contribution-sidenav">
        <div class="contribution-list-container">
          <ul class="contribution-list">
            <li class="contribution-item" @click="cur=index" :class="{cur:cur==index}"
                v-for="(item,index) in menuList" :key="index">
              <span class="text">{{item}}</span>
              <span :class="['num',{'cur-color':cur==index}]">2</span>
            </li>
          </ul>
        </div>
      </div>
    </div>
    <!--右边部分-->
    <div class="main-content">
      <div style="display: flex;position: relative">
        <p class="video-title">我的视频</p>
        <div class="be-tab">
          <ul class="be-tab-inner clearfix">
            <li :class="['be-tab-item',{isActive:isActive==1}]" @click="barOffset=0;isActive=1">
              <span>最新发布</span>
            </li>
            <li :class="['be-tab-item',{isActive:isActive==2}]" @click="barOffset=68;isActive=2">
              <span>最多播放</span>
            </li>
            <li :class="['be-tab-item',{isActive:isActive==3}]" @click="barOffset=136;isActive=3">
              <span>最多收藏</span>
            </li>
          </ul>
          <div class="be-tab-cursor" :style="barStyle"></div>
        </div>
        <div class="be-tab-right">
          <div class="more-operation common-hover-border">
            <span class="iconfont icon-bofang1"></span>
            全部播放
          </div>
          <span @click="isListStyle=true" class="iconfont icon-s-grid span-size-cur span-margin" :class="{isActive:isListStyle==true}"></span>
          <span @click="isListStyle=false" class="iconfont icon-liebiao2 span-size-cur" :class="{isActive:isListStyle==false}"></span>
        </div>
      </div>
      <!--视频类型分类查询-->
      <div class="submit-video-type-filter">
        <a href="javascript:void(0)" :class="{isActive:isVideoFilter==index}" @click="isVideoFilter=index"
           v-for="(item,index) in videoTypeFilterList" :key="index">{{item.filterType}}<span class="count">{{item.count}}</span></a>
      </div>
      <!--视频列表-->
      <initial-video-item v-if="isListStyle" :list="compilationTempData" :other-style="false"></initial-video-item>
      <my-video-item v-else :myVideoList="3"></my-video-item>
    </div>
  </div>
</template>

<script>
import InitialVideoItem from "@/components/personalHomepageComponent/tabs/initialVideoItem";
import MyVideoItem from "@/components/personalHomepageComponent/tabs/myVideoltem";
export default {
  /**投稿组件**/
  name: "contributePage",
  components: {MyVideoItem, InitialVideoItem},
  data(){
    return{
      cur: 0,
      menuList:['视频','音频','图文'],
      // 标签默认宽度
      barWidth: 48,
      // 标签偏移量
      barOffset: 0,
      isActive: 1,
      isListStyle:true,
      videoTypeFilterList:[],
      isVideoFilter:0,
      compilationTempData:[
        {title:'西西酱',views:141,date:'2-4'},
        {title:'东东酱',views:5121,date:'9-7'},
        {title:'阿里酱',views:341,date:'3-4'},
        {title:'康纳酱',views:341,date:'6-4'},
      ]
    }
  },
  created() {
    this.createList()
  },
  computed: {
    // 动态计算标签默认宽度和偏移量
    barStyle() {
      return {
        width: `${this.barWidth}px`,
        transform: `translate3d(${this.barOffset}px,0px,0px)`
      }
    },
  },
  methods:{
    createList(){
      for (let i = 0; i < 10; i++) {
        let obj = {}
        obj.filterType = '游戏'
        obj.count = i + 1
        this.videoTypeFilterList.push(obj)
      }
    }
  },
}
</script>

<style scoped>
.wrapper {
  border-radius: 4px;
  overflow: hidden;
  background: #fff;
  width: 1283px!important;
}
.col-full {
  /*background: #fff;*/
  float: left;
}
.contribution-sidenav {
  width: 210px;
  position: relative;
  margin-right: -1px;
  font-size: 14px;
  color: #222;
  /*border-right: 1px solid #eee;*/
  box-sizing: border-box;
}
.contribution-list-container ul{
  list-style: none;
}
.contribution-list-container {
  font-size: 14px;
  color: #222;
  position: relative;
  max-height: 420px;
  margin: 10px 0 20px;
  overflow: hidden;
}
.contribution-item {
  position: relative;
  padding-left: 30px;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
}
.text {
  display: inline-block;
  width: 130px;
  line-height: 44px;
  margin-right: 5px;
  font-size: 14px;
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.num {
  display: inline-block;
  width: 32px;
  font-size: 12px;
  color: #99a2aa;
  vertical-align: middle;
  text-align: center;
  font-family: Arial;
}
.cur{
  background-color: #00a1d6;
  color: white;
}
.cur-color{
  color: white;
}
.main-content{
  float: right;
  width: 1073px;
  border-left: 1px solid #eee;
  padding: 20px;
}
.video-title {
  font-size: 20px;
  line-height: 26px;
  height: 26px;
  color: #222;
}
.be-tab {
  position: relative;
  float: left;
  margin-left: 20px;
}
.be-tab-inner{
  list-style: none;
  display: block;
}
.clearfix{
  zoom: 1;
}
.be-tab-item {
  float: left;
  font-size: 12px;
  margin-right: 20px;
  line-height: 28px;
  vertical-align: top;
  cursor: pointer;
}
.be-tab-cursor:after {
  content: "";
  left: 55%;
  transform: translateX(-50%);
  margin-left: -3px;
  border-bottom: 3px solid #00a1d6;
  border-top: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
}
.be-tab-cursor:after {
  position: absolute;
  bottom: 0;
  height: 0;
  width: 0;
}
.be-tab-cursor{
  left: 0;
  border-bottom: 1px solid #00a1d6;
  transition: width .2s ease,transform .2s ease;
}
.be-tab-right{
  position: absolute;right: 0;color: #9499a0;
}
.isActive {
  color: #00a1d6;
}
.more-operation{
  cursor: pointer;
  border: 1px solid #b8c0cc;border-radius: 4px;color: #6d757a;font-size: 12px;padding: 3px 10px;display: inline;
}
.more-operation span{
  font-size: 12px;
}
.span-size-cur{
  font-size: 16px;
  cursor: pointer;
}
.span-margin{
  margin: 0 10px;
}
.common-hover-border:hover {
  color: #00a1d6;
  border: 1px solid #00a1d6;
}
.common-hover-border:hover span {
  color: #00a1d6;
}
.submit-video-type-filter {
  background: #edf2f9;
  border-radius: 4px;
  line-height: 36px;
  margin: 18px 0 10px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  font-size: 12px;
}
.submit-video-type-filter a {
  display: inline-flex;
  align-items: center;
  margin-right: 30px;
  cursor: pointer;
  text-decoration: none;
}
.submit-video-type-filter a .count {
  color: #aaa;
  margin-left: 8px;
}
</style>
